class Solution {
public:
    int minChanges(int n, int k)
    {
        int cnt = 0;
        for (int i = 0; i < 32; i++)
            if (((n >> i) & 1) == 1 && ((k >> i) & 1) == 0) n ^= (1 << i), cnt++;
        return n == k ? cnt : -1;
    }
};